package com.de.controller;

import com.de.pojo.AdminAccount;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description
 * @Date 2020/3/16
 * @Author
 * @Version
 **/
@Controller
public class requestBody {


    @PostMapping("/requestBody")
    @ResponseBody
    public int requestBody(AdminAccount adminAccount, HttpServletRequest request) {
        String contentType = request.getContentType();
        System.out.println(contentType);
        System.out.println("获得账号：" + adminAccount.getAccount());
        System.out.println("获得密码：" + adminAccount.getPassword());
        return 1;
    }

//
//        @PostMapping("/requestBody")
//    @ResponseBody
//    public int requestBody(@RequestParam String account, @RequestParam String password, HttpServletRequest request){
//        String contentType = request.getContentType();
//        System.out.println(contentType);
//        System.out.println("获得账号：" + account);
//        System.out.println("获得密码：" + password);
//        return 1;
//    }


//        @PostMapping("/requestBody")
//    @ResponseBody
//    public int requestBody(@RequestBody AdminAccount adminAccount, HttpServletRequest request) {
//        String contentType = request.getContentType();
//        System.out.println(contentType);
//        System.out.println("获得账号：" + adminAccount.getAccount());
//        System.out.println("获得密码：" + adminAccount.getPassword());
//        return 1;
//    }


//    @PostMapping("/requestBody")
//    @ResponseBody
//    public int requestBody(@RequestBody String list, HttpServletRequest request) {
//        String contentType = request.getContentType();
//        System.out.println(contentType);
//        System.out.println(list);
//        JSONObject parse = (JSONObject)JSONObject.parse(list);
//        System.out.println(parse);
//        return 1;
//    }


}
